const storageManager = require('../storage');

/**
 * 数据库表列表资源
 */
module.exports = {
  name: 'database-tables',
  description: '当前项目的数据库表列表',
  handler: async () => {
    try {
      const tables = storageManager.getTables();
      
      // 返回表的基本信息
      return tables.map(table => ({
        id: table.id,
        name: table.name,
        description: table.description,
        columnCount: table.columns ? table.columns.length : 0,
        indexCount: table.indexes ? table.indexes.length : 0,
        createdAt: table.createdAt,
        updatedAt: table.updatedAt
      }));
    } catch (error) {
      return {
        error: error.message
      };
    }
  }
}; 